#include<bits/stdc++.h>
using namespace std;
#define int long long

struct node {
	int level, times;
};

int dk[] = {1, -1};

int n, a, b;
int k[205];
bool vis[205];

int ans[205];

void bfs() {
	memset(ans, -1, sizeof ans);
	queue<node> q;
	q.push({a, 0});
	vis[a] = 1;

	while (!q.empty()) {
		node t = q.front();
		q.pop();

		ans[t.level] = t.times;

		for (int i = 0; i < 2; i++) {
			int ll = t.level + dk[i] * k[t.level];

			if (ll < 1 || ll > n || vis[ll])
				continue;

			q.push({ll, t.times + 1});
			vis[ll] = 1;
		}
	}
}

signed main() {
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++)
		cin >> k[i];
	bfs();
	cout << ans[b];
	return 0;
}
